//测试
// var base_url = 'https://vendormina.lzljtdpx.com/';
//腾讯云测试
// var base_url = 'https://vendor.lzljtdpx.com/';
//正式1
var base_url = 'https://vendorapi.lzljtdpx.com/';
//正式2
// var base_url = 'https://sh-vendorapi.lzljtdpx.com/';

var api = require('utils/api.js')
var util = require('utils/util.js');

App({
   onLaunch: function() {
      var that = this;
      wx.getSystemInfo({
         success: function(res) {
            that.globalData.windowHeight = res.windowHeight
         }
      })
   },
   onShow: function(options) {
      if (options.scene) {
         this.globalData.sceneId = options.scene
      }
      this.publicValidate();
   },
   globalData: {
      loginTo: true, //是否能跳转登录
      userInfo: null,
      accountInfo: {},
      base_url: base_url,
      error_toast_duration: 2000,
      login_url: base_url + 'user/login',
      servicePhone: '4000788519', //客服电话
      companyName: '成都飘香酒掌柜科技有限公司',
      taxNumber: '91510100MA6C5WRW77',
      bankName: '中国建设银行股份有限公司成都高新支行',
      bankNumber: '51050140613700001872'
   },
   // 说说详情
   publicValidate: function() {
      var that = this;
      api.POST({
         url: base_url + 'user/checkLogin',
         params: {},
         success: function(res) {
            wx.hideLoading();
            if (util.isEmpty(res.data.code)) {
               if (res.data.data.login == 1) {
                  wx.navigateTo({
                     url: '/pages/login/login',
                  })
               }
            }
         },
         fail: function(res) {
            util.showError("请检查网络");
            setTimeout(function() {
               wx.navigateBack({
                  delta: 1
               })
            }, 2000);
         }
      });
   },
})